Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function FB type reference search #969

Merged

Conversation

lindhuber
Copy link

No description provided.

@lindhuber lindhuber requested a review from azoitl January 17, 2025 12:17
Copy link

github-actions bot commented Jan 17, 2025

Test Results

   111 files  +   68     111 suites  +68   49s ⏱️ +14s
29 175 tests +7 009  29 175 ✅ +7 009  0 💤 ±0  0 ❌ ±0 
29 176 runs  +7 009  29 176 ✅ +7 009  0 💤 ±0  0 ❌ ±0 

Results for commit 578799b. ± Comparison against base commit 113a2f9.

♻️ This comment has been updated with latest results.

@lindhuber lindhuber force-pushed the functionTypeReferenceSearch branch from 34839a0 to 7680f79 Compare January 22, 2025 08:36
@lindhuber lindhuber marked this pull request as ready for review January 22, 2025 08:38
@lindhuber lindhuber requested a review from oberlehner January 22, 2025 08:38
@oberlehner
Copy link
Contributor

when searching for the fct hello i get this exception:
image

Addiontally there is one instance of the function inside an Application, which should not make a difference

This looks like an ST error for me but i am not sure.

!ENTRY org.eclipse.core.jobs 4 2 2025-01-22 13:53:46.443
!MESSAGE An internal error occurred during: "hello".
!STACK 0
org.eclipse.fordiac.ide.model.eval.EvaluatorPrepareException: LIMIT_CHECK at 14: The callable CHECK(INT, INT, INT, BOOL) is undefined, LIMIT_CHECK at 14: The parameter Minv is undefined, LIMIT_CHECK at 14: The parameter Maxv is undefined, LIMIT_CHECK at 15: The callable CHECK(INT, INT, INT, BOOL) is undefined
	at org.eclipse.fordiac.ide.model.eval.st.STFunctionBodyEvaluator.prepare(STFunctionBodyEvaluator.java:55)
	at org.eclipse.fordiac.ide.model.eval.st.STFunctionBodyEvaluator.getDependencies(STFunctionBodyEvaluator.java:97)
	at org.eclipse.fordiac.ide.model.eval.fb.FunctionFBEvaluator.getDependencies(FunctionFBEvaluator.java:65)
	at org.eclipse.fordiac.ide.model.eval.variable.VariableOperations.getAllDependencies(VariableOperations.java:391)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.matchInST(ModelSearchQuery.java:323)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.matchEObject(ModelSearchQuery.java:298)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.matchTypeEntry(ModelSearchQuery.java:258)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.lambda$4(ModelSearchQuery.java:109)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3612)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.performSearch(ModelSearchQuery.java:104)
	at org.eclipse.fordiac.ide.model.search.ModelSearchQuery.run(ModelSearchQuery.java:81)
	at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:94)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

@oberlehner oberlehner requested a review from mx990 January 22, 2025 12:59
@mx990
Copy link
Member

mx990 commented Jan 22, 2025

Yes, if there is an error in the ST code, the dependencies cannot be accurately determined, so an exception is thrown instead of returning a potentially incomplete result. I would suggest catching the exception in ModelSearchQuery .matchInST(...), possibly also informing the user that the search result may be inaccurate due to errors.

Inform the user that a search result may be inaccurate if the resolved st code contains errors.
@lindhuber
Copy link
Author

There is still the issue of the "Find References" entry in the xtext editor. It works as expected with function calls but not with function definitions. What I have seen so far is that function calls get resolved to FunctionFBTypes while definitions are resolved to STFunctions (which results in slightly different URIs, e.g. ...TestFunction.fct#/0/@functions.0 for calls and ...TestFunction.fct#/1 for definitions). I am putting this here for future reference (and because I have no clue how xtext editors work).

@oberlehner oberlehner merged commit 19a9b16 into eclipse-4diac:develop Jan 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants